// 先引入经过自定义全局封装的 axios
import request from '/@/utils/request';

/**
 * 活动列表
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function schemeList(params: any) {
	let paramsQuery: any = params;
	paramsQuery.current = params.pageNum;
	paramsQuery.size = params.pageSize;
	return request({
		url: '/promo/scheme/list',
		method: 'post',
		data: params,
	});
}

/**
 * 活动详情
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function schemeDetails(id: number) {
	return request({
		url: `/promo/scheme/${id}`,
		method: 'get',
		data: {},
	});
}

/**
 * 活动新增编辑
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function schemeAdd(param: any) {
	return request({
		url: `/promo/scheme/upsert`,
		method: 'post',
		data: param,
	});
}

/**
 * 删除活动
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 *
 */
export function schemeDel(id: number) {
	return request({
		url: `/promo/scheme/${id}`,
		method: 'delete',
		data: {},
	});
}

/**
 * 储值卡列表
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function ppcList(params: any) {
	let paramsQuery: any = params;
	paramsQuery.current = params.pageNum;
	paramsQuery.size = params.pageSize;
	return request({
		url: '/ppc/list',
		method: 'post',
		data: params,
	});
}

 /**
 * 储值卡详情
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 *
 */
export function ppcDetails(id: number) {
	return request({
		url: `/ppc/${id}`,
		method: 'get',
		data: {},
	});
}

/**
 * 储值卡新增编辑
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function ppcAdd(param: any) {
	return request({
		url: `/ppc/upsert`,
		method: 'post',
		data: param,
	});
}

/**
 * 删除储值卡
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 *
 */
export function ppcDel(id: number) {
	return request({
		url: `/ppc/${id}`,
		method: 'post',
		data: {},
	});
}



/**
 * 代金券统计
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function couponStatistics() {
	return request({
		url: '/applet/marketing/coupon/statistics',
		method: 'GET',
	});
}

/**
 * 代金券列表
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function voucherList(params: any) {
	let paramsQuery: any = params;
	paramsQuery.current = params.pageNum;
	paramsQuery.size = params.pageSize;
	return request({
		url: '/applet/marketing/coupon/list',
		method: 'GET',
		data: params,
	});
}

/**
* 发放代金券
* @param params 要传的查询参数值
* @returns 返回接口数据
*/
export function sendCoupon(params: any) {
	return request({
		url: '/applet/marketing/coupon/user/send',
		method: 'POST',
		data: params,
	});
}


/**
* 代金券列表
* @param params 要传的查询参数值
* @returns 返回接口数据
*/
export function couponList(params: any) {
   let paramsQuery: any = params;
   paramsQuery.current = params.pageNum;
   paramsQuery.size = params.pageSize;
   return request({
		url: '/applet/marketing/coupon/list',
		method: 'GET',
		params:paramsQuery,
   });
}
/**
 * 代金券新增编辑
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */ 
export function couponAdd(param: any) {
	return request({
		url: `/applet/marketing/coupon/save`,
		method: 'POST',
		data: param,
	});
}


/**
 * 代金券详情
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function couponInfo(id: any) {
	return request({
		url: `/applet/marketing/coupon/info?id=${id}`,
		method: 'GET',
	});
}

/**
 * 代金券状态修改
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function couponStatus(param: any) {
	return request({
		url: `/applet/marketing/coupon/status`,
		method: 'POST',
		data: param,
	});
}


/**
 * 代金券删除
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function couponDelete(id: number) {
	return request({
		url: `/applet/marketing/coupon/delete?id=${id}`,
		method: 'DELETE',
	});
}

/**
 * 代金券领取记录
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */
export function couponReceiveList(params: any) {
	let paramsQuery: any = params;
	paramsQuery.current = params.pageNum;
	paramsQuery.size = params.pageSize;
	return request({
		url: '/applet/marketing/coupon/user/list',
		method: 'GET',
		params: paramsQuery,
	});
}

 /**
 * 代金券详情
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 *
 */
export function voucherDetails(id: number) {
	return request({
		url: `/voucher/${id}`,
		method: 'get',
		data: {},
	});
}

/**
 * 代金券新增编辑
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 */ 
export function voucherAdd(param: any) {
	return request({
		url: `/voucher/upsert`,
		method: 'post',
		data: param,
	});
}

/**
 * 删除代金券
 * @param params 要传的查询参数值
 * @returns 返回接口数据
 *
 */
export function voucherDel(id: number) {
	return request({
		url: `/voucher/${id}`,
		method: 'delete',
		data: {},
	});
}



// 秒杀配置列表
export function seckillList(params: any) {
	let paramsQuery: any = params;
	paramsQuery.current = params.pageNum;
	paramsQuery.size = params.pageSize;
	return request({
		url: '/applet/marketing/seckill/manager/list',
		method: 'GET',
		params:paramsQuery,
	});
}


// 新增秒杀活动配置
export function seckillAdd(params: any) {
	return request({
		url: '/applet/marketing/seckill/manager/save',
		method: 'POST',
		data:params,
	});
}

// 编辑秒杀活动配置
export function seckillEdite(params: any) {
	return request({
		url: '/applet/marketing/seckill/manager/update',
		method: 'POST',
		data:params,
	});
}
// 删除秒杀活动配置
export function seckillDelete(id: string) {
	return request({
		url: '/applet/marketing/seckill/manager/delete?id='+id,
		method: 'DELETE',
	});
}

// 秒杀商品列表
export function seckillGoodsList(params: any) {
	return request({
		url: '/applet/marketing/seckill/list',
		method: 'GET',
		data:params,
	});
}
//秒杀商品添加商品-模板id获取

export function getModelIdList(){
	return request({
		url: '/admin/express/shipping/templates/list',
		method: 'GET',
	});
}
//添加秒杀商品
export function addSeckillGoods(params: any){
	return request({
		url: '/applet/marketing/seckill/save',
		method: 'POST',
		data:params,
	});
}

//修改秒杀商品的状态
export function changeSeckillGoodsStatus(id:number, status:number){
	return request({
		url: `/applet/marketing/seckill/update/status?id=${id}&status=${status}`,
		method: 'POST',
	});
}

//修改秒杀商品的状态
export function changeSeckillActionStatus(params: any){
	return request({
		url: '/applet/marketing/seckill/manager/status',
		method: 'POST',
		data:params,
	});
}

//修改秒杀商品的状态
export function getGoodsInfosByIds(params: any){
	return request({
		url: '/product/goods/operate',
		method: 'POST',
		data:params,
	});
}


